﻿<!DOCTYPE html>
<!--作业基本信息配置列表-->
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="/static/js/common.js"></script>

    <link href="../static/js/vue-treeselect/vue-treeselect.css" rel="stylesheet" />
    <script src="../static/js/vue-treeselect/vue-treeselect.js"></script>
    <style>
        body {
            padding-bottom: 10px;
        }


        .el-dialog__body {
            height: 100% !important;
        }

        .el-dialog.is-fullscreen {
            overflow: hidden !important;
        }

        .vue-treeselect__control {
            height: 100%;
            border: none;
            background: none;
        }

        .vue-treeselect__placeholder {
            top: -3px;
        }

        .vue-treeselect__single-value {
            top: -3px;
        }

        .el-col {
            padding: 10px;
            font-size: 14px
        }

        .el-form-item {
            margin-bottom: 0px !important;
        }

        .el-input-group__prepend,
        .el-input__inner,
        .el-form-item__label {
            color: #000;
            font-size: 14px;
            /* padding: 0!important */
        }

        .el-textarea__inner {
            color: #606266
        }

        .el-form-item__label {
            padding: 0 !important;
        }

        .el-textarea__inner {
            margin-top: 3px
        }
    </style>
</head>

<body>
    
<div id="app" v-cloak>   
        <div style="width:100%;text-align:center ">
            <label style="font-weight:bold">作业前安全分析（JSA）表</label>
        </div>
        <el-form :model="Form" status-icon style="margin-top:5px;width:100%" class="safeCard">
            <el-row>
                <el-col span="8" style=" font-size:14px;margin-top: 5px;">
                    <!--<el-form-item :label="JSPAnalyticalManagement.OperatingUnitDerp+mark.m">-->
                    {{JSPAnalyticalManagement.OperatingUnitDerp+mark.m}} {{Form.OperatingUnit}}
                    <!--</el-form-item>-->
                </el-col>
                <el-col span="8" style=" font-size:14px">
                    <!--<el-form-item :label="JSPAnalyticalManagement.ApplicationTime+mark.m">-->
                    {{JSPAnalyticalManagement.ApplicationTime+mark.m}}{{Form.ApplicationTime}}
                    <!--</el-form-item>-->
                </el-col>
                <el-col span="8" style="  font-size:14px">
                    <!--<el-form-item :label="JSPAnalyticalManagement.ApplicationNumber+mark.m">-->
                    {{JSPAnalyticalManagement.ApplicationNumber+mark.m}} {{Form.ApplicationNumber}}
                    <!--</el-form-item>-->
                </el-col>
            </el-row>
            <el-row style="border:1px  solid;   ">
                <el-col span="8" style="font-size:14px">
                    <!--<el-form-item :label="JSPAnalyticalManagement.JobManagere+mark.m">-->
                    {{JSPAnalyticalManagement.JobManagere+mark.m}} {{Form.JobManagere}}
                    <!--</el-form-item>-->
                </el-col>
                <el-col span="16" style=" ">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{JSPAnalyticalManagement.Approver+mark.m}}
                                </template>
                                <treeselect v-model="Form.Approver" :options="PersonInCharge" :flat="true"
                                    :show-count="true" :disable-branch-nodes="true" slot="suffix"
                                    style="line-height: 28px;width:70%;float: right;" placeholder="请选择" />
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
            </el-row>
            <el-row style="border:1px  solid; border-top:0px;  ">
                <el-col span="24">
                    <el-form-item :label="JSPAnalyticalManagement.WorkDescription+mark.m">
                        <el-input type="textarea" v-model="Form.WorkDescription">
                        </el-input>
                    </el-form-item>
                </el-col>
            </el-row>

            <el-row style="border:1px  solid; border-top:0px;  ">
                    <el-col span="24">
                        <el-form-item :label="JSPAnalyticalManagement.PersonalProtectiveEquipment+mark.m">
                            <el-input type="textarea" v-model="Form.PersonalProtectiveEquipment">
                            </el-input>
                        </el-form-item>
                    </el-col>
                </el-row>

            <!--风险识别及安全措施:跳多个风险步骤-->
            <!--<el-row style="border:1px  solid; border-top:0px;    ">
                <el-col span="4" style="  ">
                    {{JSPAnalyticalManagement.RiskIdentificationSafety+mark.m}}
                    <br />
                    <a href="javascript:void(0)" @click="Riskstep('tj')">添加</a>
                </el-col>
                <el-col span="20" style="  ">
                    <el-table :data="Form.RiskIdentificationSafety" style="width: 90%;margin-bottom: 20px;" border
                              row-style="height:10px">
                        <el-table-column type="expand">
                            <template slot-scope="props">
                                <el-form label-position="left" inline class="demo-table-expand">
                                    <table style=" width:90%; " cellpadding="0" cellspacing="0">
                                        <thead>
                                            <tr>
                                                <td style="text-align:center">{{JSPAnalyticalManagement.Risk}}</td>
                                                <td style=" text-align:center">{{JSPAnalyticalManagement.HazardousFactors}}</td>
                                                <td style=" text-align:center">{{JSPAnalyticalManagement.ControlRequirements}}</td>
                                            </tr>
                                        </thead>
                                        <tbody v-for="todo in props.row.List">
                                            <tr>
                                                <td style=" text-align:center">{{todo.Risk}}</td>
                                                <td style=" text-align:center">{{todo.HazardousFactors}}</td>
                                                <td style=" text-align:center">{{todo.ControlRequirement}}</td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </el-form>
                            </template>
                        </el-table-column>
                        <el-table-column prop="RiskStepsName"
                                         :label="JSPAnalyticalManagement.WorkProcedure">
                        </el-table-column>
                    </el-table>
                </el-col>
            </el-row>-->


            <!--风险识别及安全措施: 只跳检维修作业活动 作业活动等于作业步骤-->


            <el-row style="border:1px  solid; border-top:0px;    ">
                <el-col style="text-align: left">
                    {{JSPAnalyticalManagement.RiskIdentificationSafety+mark.m}}
                    <a href="javascript:void(0)" @click="MaintenanceActivities('tj')">添加</a>
                </el-col>
            </el-row>
            <el-row style="border:1px  solid; border-top:0px;    ">
                <el-col style="  ">
                    <el-table :data="Form.RiskIdentificationSafety" style="width: 100%;margin-bottom: 20px;" border
                        row-style="height:10px">
                        <el-table-column type="index" :label="JobLicenseManagement.SerialNumber" :index="indexMethod"
                            width="50" show-overflow-tooltip="true"></el-table-column>
                        <el-table-column prop="RiskStepsName" :label="JSPAnalyticalManagement.WorkProcedure">
                        </el-table-column>
                        <el-table-column prop="Risk" :label="JSPAnalyticalManagement.Risk">
                        </el-table-column>
                        <el-table-column prop="HazardousFactors" :label="JSPAnalyticalManagement.HazardousFactors">
                        </el-table-column>
                        <el-table-column prop="ControlRequirement" :label="JSPAnalyticalManagement.ControlRequirements">
                        </el-table-column>
                        <el-table-column label="操作">
                            <template slot-scope="scope">
                                <el-button
                                    @click.native.prevent="deleteRow(scope.$index, Form.RiskIdentificationSafety)"
                                    type="text" size="small">
                                    移除
                                </el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </el-col>
            </el-row>
            <el-row style="border:1px  solid; border-top:0px;    ">
                <el-col style="text-align: left">
                    {{JSPAnalyticalManagement.ParticipateJSPAnalysts+mark.m}}
                    <a href="javascript:void(0)" @click="UserInput('tj')">添加</a>
                </el-col>
            </el-row>
            <el-row style="border:1px  solid; border-top:0px;    ">
                <el-col>
                    <el-table :data="Form.ParticipateJSPAnalysts" border style="width: 100%">
                        <el-table-column prop="Unit" :label="JSPAnalyticalManagement.Unit">
                        </el-table-column>
                        <el-table-column prop="JSPAnalyst" :label="JSPAnalyticalManagement.JSPAnalyst">
                        </el-table-column>
                        <el-table-column label="操作">
                            <template slot-scope="scope">
                                <el-button @click.native.prevent="deleteRow(scope.$index, Form.ParticipateJSPAnalysts)"
                                    type="text" size="small">
                                    移除
                                </el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </el-col>
            </el-row>
            <el-row>
                <el-form-item style="text-align:center; padding-top:5px">
                    <!--<el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnSave}}</el-button>-->
                    <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnCommit}}</el-button>
                    <!--<el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnBack}}</el-button>-->
                </el-form-item>
            </el-row>
        </el-form>
        <el-dialog :title="title" :visible.sync="ListItem.dialogVisible" width="60%" height="90%" top="10vh"
            fullscreen="true">
            <iframe ref="iframe" :src="ListItem.InputUrl" style="height:95%;width:100%" frameborder="0"></iframe>
        </el-dialog>
    </div>
    <script type="text/javascript">
        Vue.component('treeselect', VueTreeselect.Treeselect)
        app = new Vue({
            el: '#app',
            data: {
                id: '',
                title: '',
                Form: {
                    JobApproverDepartment: '',
                    OperatingUnit: '',//作业单位
                    ApplicationNumber: '',//申请编号
                    ApplicationTime: '',//申请时间
                    JobManagere: '',//作业负责人
                    Approver: null,//审批人
                    WorkDescription: '',//工作描述
                    PersonalProtectiveEquipment: '',//要求和建议的个人防护用品
                    RiskIdentificationSafety: [],//风险识别及安全措施
                    ParticipateJSPAnalysts: []//分析人


                },
                mydata: PersonInChargeTree,
                PersonInCharge: [],
                JobApproverDepartment: [],
                Approver: [],
                rules: {},
                ListItem: ListItem,

            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                indexMethod: function (index) {
                    return (this.ListItem.currentPage - 1) * this.ListItem.pagesize + index + 1;
                },
                handleNodeClick: function (data) {
                    console.log(data);
                },
                deleteRow: function (index, rows) {
                    rows.splice(index, 1);
                },
                getData: function () {
                    getData(this, '/api/JSPAnalyticalManagement/get?id=' + this.id);
                },


                Riskstep: function (val, id) {
                    this.title = "风险识别及安全措施管理";
                    DialogShow(this, val, "../JobSafetyManagement/GeneralLiftingWorkSafety/RiskstepsInformationBaseList.html", id);
                },

                //只跳检维修作业活动 作业活动等于作业步骤
                MaintenanceActivities: function (val, id) {
                    this.title = "风险识别及安全措施管理";
                    DialogShow(this, val, "../JobSafetyManagement/StasRiskControlInformationDatabase/MaintenanceActivitiesList.html", id);
                },

                UserInput: function (val, id) {
                    this.title = "参与JSA分析人管理";
                    DialogShow(this, val, "ParticipateJSPAnalystsInput.html", id);
                },

                onSubmitForm: function (formName) {
                    var mythis = this;
                    //this.$refs[formName].validate(function (valid) {
                    //    //验证通过
                    //    if (valid) {
                    onSubmitForm(this, '/api/JSPAnalyticalManagement/Save', mythis.Form);
                    //} else {
                    //    //验证失败
                    //    return false;
                    //}
                    //});
                },
            },
            mounted: function () {
                this.PersonInCharge = fn(this.mydata, "0");
                //var list = getDicDataArray([ '14', '16']);

                //this.JobApproverDepartment = getDicDatafromArray('14', list);
                //this.Approver = getDicDatafromArray('16', list);
                this.id = getUrlParam("id");
                this.getData();
                if (this.id == null) {
                    //getData(this, '/api/JobLicenseManagement/getA?id=' + this.id);
                    this.Form.OperatingUnit = "作业单位";
                    this.Form.ApplicationNumber = "申请编号";
                    this.Form.ApplicationTime = "2019-05-30";
                    this.Form.JobManagere = "作业负责人";
                }
            }
        });
    </script>
</body>

</html>